//
//  PathUtil.m
//  SWCommonFrame
//
//  Created by shaowei on 13-6-19.
//  Copyright (c) 2013年 shaowei. All rights reserved.
//

#import "SWPathUtil.h"

@implementation SWPathUtil

/**
 返回App文件夹下的Document目录路径，加上参数的子路径 (Document).
 @param Document目录下的子路径
 @returns 完整路径
 */
+ (NSString *)getAppDocumentPath:(NSString *)extraPath{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentPath = [paths objectAtIndex:0];
    if (extraPath) {
        documentPath = [documentPath stringByAppendingPathComponent:extraPath];
    }
    
    return documentPath;
}

/**
 返回App文件夹下的cache缓存目录路径，加上参数的子路径 (Library/Caches).
 @param cache缓存目录下的子路径
 @returns 完整路径
 */
+ (NSString *)getAppCachePath:(NSString *)extraPath{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *documentPath = [paths objectAtIndex:0];
    if (extraPath) {
        documentPath = [documentPath stringByAppendingPathComponent:extraPath];
    }
    
    return documentPath;
}



@end
